seajs.config({
    alias: {
        "$": "lib/jquery/jquery-1.8.3.js",
        "util": "lib/util/util.js",
        "underscore": "lib/underscore/underscore.js"
    },

    preload: [
        '$', 'underscore', 'util'
    ],

    vars: {
        'assets': RemoteUrl + 'assets/',
        'apiUrl': ApiUrl,
        'modules': RemoteUrl + 'modules/'
    },

    debug: true,

    base: RemoteUrl + 'assets/',

    charset: 'utf-8'
});

if (location.href.indexOf("?dev") > 0) {
    seajs.config({
        'map': [
            [/^(.*\.(?:css|js|tpl))(.*)$/i, '$1?v=' + Version]
        ]
    });
} else {
    seajs.config({
        'map': [
            [/(.*\/)(.+)(\.(tpl|css|js))$/i, function(src, path, name, ext) {
                if (/^!@-.*/.test(name)) {
                    return src;
                } else {
                    return path + '!@-' + hex_md5(name + Version) + ext;
                }
            }]
        ]
    });
}

seajs.use(['$', 'underscore', 'util'], function($, underscore, util) {
    window._ = underscore;
    window.$ = $;
    window.Util = util;
    seajsLoaded();
});